<template>
  <div class="view-container">
    <div class="main-content">
      <div class="list-container">
        <div class="my-tabs-container">
          <div class="my-tabs">
            <el-tabs
              v-model="activeName"
              @tab-click="handleClick"
            >
              <el-tab-pane
                label="月目标与考核"
                name="monthAssessment"
              />
              <el-tab-pane
                label="季目标与考核"
                name="quarterAssessment"
              />
              <el-tab-pane
                label="年目标与考核"
                name="yearAssessment"
              />
            </el-tabs>
          </div>
        </div>
        <month-assessment />
        <!--
        <component
          :is="activeName"
          ref="comp"
          navigation="finance"
        />
        -->
      </div>
    </div>
  </div>
</template>

<script>
import {defineAsyncComponent, reactive, toRefs} from 'vue'
import {useRoute, useRouter} from 'vue-router'

export default {
  components: {
    monthAssessment: defineAsyncComponent(() =>
      import('./monthAssessment.vue')
    ),
  },
  setup(props, context) {
    const route = useRoute()
    const router = useRouter()
    var datas = reactive({
      activeName: route.query.tabs || 'monthAssessment',
      cashRef: null,
      comp: null,
    })
    const handleClick = (tab, event) => {
      console.log(tab, event)
      router.push({
        name: 'assessment',
        query: {
          tabs: tab.props.name,
        },
      })
    }
    return {
      ...toRefs(datas),
      handleClick,
    }
  },
}
</script>

